#include <54func.h>
#include <string>
#include <iostream>
#include <SimpleAmqpClient/SimpleAmqpClient.h>
using std::string;
using std::cout;
struct MQInfo{
    string Exchange = "exchange_test";
    string RoutingKey = "key1";
    string Queue = "queue3";
};
int main(){
    using namespace AmqpClient;
    MQInfo mqinfo;
    // create为channel申请内存
    Channel::ptr_t channel = Channel::Create();
    // 调用basicconsume 创建一个消费过程
    channel->BasicConsume(mqinfo.Queue);
    Envelope::ptr_t envelope;
    while(1){
        bool flag = channel->BasicConsumeMessage(envelope,-1);
        if(flag){
            cout << "message = " << envelope->Message()->Body() << "\n";
        }
        else{
            cout << "timeout\n";
        }
    }
    return 0;
}

